#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main()
{
	int k;
	double sum, d, f;
	sum = 0; k = 1; f = 1;
	do
	{
		d = f / (k * (k + 1));
		sum = sum + d;
		k = k + 1;
		f = -f;
	} while (d > 1.0e-4);
	printf("sum=%d\n", sum);
	return 0;
}